#include <iostream>

#include "array.h"

using namespace std;

int main() {
	Array array(10);

	cout << array << endl;

	for (ArrayIterator iter = array.begin(); iter != array.end(); ++iter)
		cout << iter << ": " << *iter << endl;

	int a[] = {10, 20, 30, 40, 50};

	array = Array(5, a);

	cout << array << endl;

	for (ArrayIterator iter = array.begin(); iter != array.end(); ++iter)
		cout << iter << ": " << *iter << endl;

   try
   {
      ArrayIterator iter2 = array.end();
      ++iter2;
      cout << *iter2 << endl;
   }
   catch (ArrayIndexOutOfBounds e)
   {
      cout << "ERROR: " << e.message.c_str() << endl;
   }

   try
   {
      ArrayIterator iter3 = array.end();
      cout << *iter3 << endl;
   }
   catch (ArrayIndexOutOfBounds e)
   {
      cout << "ERROR: " << e.message.c_str() << endl;
   }

	return 0;
}
